<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"></meta>
    <meta http-equiv="Expires" content="0"></meta>
    <meta http-equiv="Cache-Control" content="no-cache"></meta>
    <meta http-equiv="Cache-Control" content="no-store"></meta>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"></meta>
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<title>GGKB | Entity</title>
	<link rel="shortcut icon" href="favicon.ico">
	<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
	<link rel="stylesheet" th:href="@{/css/font-awesome.min.css}">
	<link rel="stylesheet" th:href="@{/css/ionicons.min.css}">
	<link rel="stylesheet" th:href="@{/css/entity.css}">
	<link rel="stylesheet" th:href="@{/css/plugins/layer/theme/default/layer.css}">
	<link rel="stylesheet" th:href="@{/css/plugins/bootstrap-table/bootstrap-table.min.css}">
	<link rel="stylesheet" th:href="@{/css/plugins/jqTreeGrid/jquery.treegrid.css}">
	<link rel="stylesheet" th:href="@{/css/plugins/jsTree/style.min.css}">
</head>
<body class="gray-bg" style="background-color: #f3f3f4;">
	<div class="wrapper wrapper-content">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox-content">
					<div id="companyTree"></div>
				</div>
				<div class="form-group hidden">
					<div class="col-sm-12 col-sm-offset-12">
						<button type="submit" class="btn btn-primary">提交</button>
					</div>
				</div>
			</div>
		</div>		
	</div>
	<script th:src="@{/js/jquery.min.js}"></script>
	<script th:src="@{/js/bootstrap.min.js}"></script>
	<script th:inline="javascript">var ctx = [[@{/}]];</script>
	<script th:src="@{/js/plugins/bootstrap-table/bootstrap-table.min.js}"></script>
	<script th:src="@{/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
	<script th:src="@{/js/plugins/jqTreeGrid/jquery.treegrid.min.js}"></script>
	<script th:src="@{/js/plugins/jqTreeGrid/jquery.treegrid.extension.js}"></script>
	<script th:src="@{/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js}"></script>
	<script th:src="@{/js/plugins/layer/layer.js}"></script>
	<script th:src="@{/js/plugins/jsTree/jstree.min.js}"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$.ajax({
				type : "POST",
				url : ctx + "a/company/tree",
				success : function(tree) {
					console.log(tree);
					$('#companyTree').jstree({
						'core' : {'data' : tree},
						"plugins" : [ "search" ]
					});
					
					$('#companyTree').jstree().open_all();
				}
			});
		});
		
		$('#companyTree').on("changed.jstree", function(e, data) {
			if(data.node.id != -1){
				parent.loadCompany(data.node.id, data.node.text);
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);
			}
		});		
	</script>
</body>
</html>